﻿using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;

namespace OplugAbpProject.Migrations
{
    public partial class AddEventDetail : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "MerchantEvents");

            migrationBuilder.CreateTable(
                name: "EventDetail",
                columns: table => new
                {
                    Id = table.Column<long>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    SysRowID = table.Column<string>(maxLength: 50, nullable: true),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    TenantId = table.Column<int>(nullable: true),
                    MerchId = table.Column<long>(nullable: false),
                    EventNumber = table.Column<string>(maxLength: 50, nullable: false),
                    EventType = table.Column<string>(maxLength: 20, nullable: true),
                    EventContent = table.Column<string>(type: "text", nullable: true),
                    ProblemText = table.Column<string>(type: "text", nullable: true),
                    ProblemPic = table.Column<string>(maxLength: 500, nullable: true),
                    VedioURL = table.Column<string>(maxLength: 500, nullable: true),
                    Rectification = table.Column<bool>(nullable: false),
                    EventStatus = table.Column<string>(maxLength: 8, nullable: true),
                    LastInspector = table.Column<string>(nullable: true),
                    RectificationTime = table.Column<DateTime>(nullable: true),
                    RectificationCon = table.Column<string>(type: "text", nullable: true),
                    RectificationPic = table.Column<string>(maxLength: 500, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_EventDetail", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "EventHeader",
                columns: table => new
                {
                    Id = table.Column<long>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    TenantId = table.Column<int>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    SysRowID = table.Column<string>(nullable: true),
                    EventNumber = table.Column<string>(maxLength: 50, nullable: false),
                    EventTitle = table.Column<string>(maxLength: 50, nullable: false),
                    EventStatus = table.Column<string>(maxLength: 10, nullable: true),
                    MerchId = table.Column<long>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_EventHeader", x => x.Id);
                });
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "EventDetail");

            migrationBuilder.DropTable(
                name: "EventHeader");

            migrationBuilder.CreateTable(
                name: "MerchantEvents",
                columns: table => new
                {
                    Id = table.Column<long>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    EventContent = table.Column<string>(type: "text", nullable: true),
                    EventStatus = table.Column<string>(maxLength: 8, nullable: true),
                    EventType = table.Column<string>(maxLength: 20, nullable: true),
                    LastInspector = table.Column<string>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    MerchId = table.Column<long>(nullable: false),
                    MerchSysRowID = table.Column<string>(maxLength: 50, nullable: true),
                    PictureURL = table.Column<string>(maxLength: 500, nullable: true),
                    ProblemText = table.Column<string>(type: "text", nullable: true),
                    Rectification = table.Column<bool>(nullable: false),
                    SysRowID = table.Column<string>(maxLength: 50, nullable: true),
                    TenantId = table.Column<int>(nullable: true),
                    VedioURL = table.Column<string>(maxLength: 500, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MerchantEvents", x => x.Id);
                });
        }
    }
}
